package com.projet.glb2r.Pdf;

import java.io.File;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;

public class ReadPdf extends Activity {
		@Override
		public void onCreate(Bundle savedInstanceState) {
			super.onCreate(savedInstanceState);
				File file = new File("/mnt/sdcard/Factures/Facture.pdf");
				PackageManager packageManager = getPackageManager();
				Intent testIntent = new Intent(Intent.ACTION_VIEW);
				testIntent.setType("application/pdf");
					List list = packageManager.queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY);
						if (list.size() > 0 && file.isFile()) {
								Intent intent = new Intent();
									intent.setAction(Intent.ACTION_VIEW);
									Uri uri = Uri.fromFile(file);
						intent.setDataAndType(uri, "application/pdf");
						startActivity(intent);
						}
		}
}